#include "FakeGIAmbientLight.h"

LightSample FakeGIAmbientLight::L(const Scene * scene, const Vector3 & position, const Vector3 & normal) const {
	Double cosTheta = up * normal;
	Double sin2 = (1 - cosTheta * cosTheta);
	Double sine = sin2 > 0 ? sqrt(sin2) * 0.5 : 0;
	if (cosTheta > 0)
		return LightSample(lerp(sky, ground, sine), Vector3::Zero());
	else
		return LightSample(lerp(ground, sky, sine), Vector3::Zero());
}
